package com.jk.smartelderlycare.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jk.smartelderlycare.dao.SysSignMapper;
import com.jk.smartelderlycare.dto.SysSign;
import com.jk.smartelderlycare.pojo.PagedResponse;
import com.jk.smartelderlycare.service.SysSignService;
import com.jk.smartelderlycare.utils.PaginationUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author hhk
 * @version 1.0
 * @ClassName SysSignServiceImpl
 * @program: smart-elderly-care
 * @description: TODO
 * @date 2024/11/15 15:17
 */
@Service
public class SysSignServiceImpl implements SysSignService {

    @Autowired
    private SysSignMapper sysSignMapper;
    /** 
     * @description: 后端分页查询
     * @param: [sysSign, pageNum, pageSize]
     * @return: com.jk.smartelderlycare.pojo.PagedResponse<com.jk.smartelderlycare.dto.SysSign>
     * @author hhk
     * @date: 2024/11/15 15:19
     */ 
    @Override
    public PagedResponse<SysSign> findSysSignPaginationList(SysSign sysSign, Integer pageNum, Integer pageSize) {
        Page<SysSign> page = new Page<>(pageNum, pageSize);
        IPage<SysSign>  sysSignIPage= sysSignMapper.findSysSignPaginationList(sysSign, page);
        return PaginationUtil.getPagedResponse(sysSignIPage.getRecords(),pageNum,pageSize,sysSignIPage.getTotal());
    }
    /**
     * @description: 通过
     * @param: [signId]
     * @return: void
     * @author hhk
     * @date: 2024/11/15 15:30
     */
    @Override
    public void updateStatusById(Long signId) {
        sysSignMapper.updateStatusById(signId);
        sysSignMapper.updateSignDateById(signId);

    }
    /**
     * @description: 不通过
     * @param: [signId]
     * @return: void
     * @author hhk
     * @date: 2024/11/15 15:30
     */
    @Override
    public void alStatusById(Long signId) {
        sysSignMapper.alStatusById(signId);
        sysSignMapper.updateSignDateById(signId);
    }
    /**
     * @description: 删除
     * @param: [signId]
     * @return: void
     * @author hhk
     * @date: 2024/11/15 16:00
     */
    @Override
    public void deleteSysSignById(Long signId) {
        sysSignMapper.deleteById(signId);
    }
}
